<!doctype html>
<html lang="en">
<head>
    <title>Code coverage report for src/components/Engine/Base/RegRouter.vue</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="..\..\..\..\prettify.css" />
    <link rel="stylesheet" href="..\..\..\..\base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style type='text/css'>
        .coverage-summary .sorter {
            background-image: url(..\..\..\..\sort-arrow-sprite.png);
        }
    </style>
</head>
<body>
<div class='wrapper'>
  <div class='pad1'>
    <h1>
      <a href="..\..\..\..\index.html">All files</a> / <a href="index.html">src/components/Engine/Base</a> RegRouter.vue
    </h1>
    <div class='clearfix'>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Statements</span>
        <span class='fraction'>0/22</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Branches</span>
        <span class='fraction'>0/4</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Functions</span>
        <span class='fraction'>0/10</span>
      </div>
      <div class='fl pad1y space-right2'>
        <span class="strong">0% </span>
        <span class="quiet">Lines</span>
        <span class='fraction'>0/22</span>
      </div>
    </div>
  </div>
  <div class='status-line low'></div>
<pre><table class="coverage">
<tr><td class="line-count quiet">1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94</td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-no">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span>
<span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">&lt;template&gt;
  &lt;div o-Container&gt;
    &lt;div id="div_RegReturnPanel" v-show="status"&gt;
      &lt;div class="return" v-if="source"&gt;
        &lt;div class="code" id="div_code"&gt;{{source.status.code}}, {{source.status.message}}&lt;/div&gt;
        &lt;div&gt;Register Module: {{this.$route.params.data}}&lt;/div&gt;
        &lt;!--&lt;div&gt;{{source}}&lt;/div&gt;--&gt;
      &lt;/div&gt;
      &lt;div class="noparam" v-else&gt;No Parameters Received.&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/template&gt;
&nbsp;
&lt;script&gt;
  export default {
    name: 'NotFound', /* 这个name暂时不知道用啥用，根据官方文档说的是方便排错的 */
<span class="fstat-no" title="function not covered" >    data() {</span>
<span class="cstat-no" title="statement not covered" >      return {</span>
        octopus: this.$parent.octopus,
        source: null,
        status: false
      }
    },
<span class="fstat-no" title="function not covered" >    created: function () {</span>
      // this.oData 等价于 this.octopus
<span class="cstat-no" title="statement not covered" >      this.oData.tips.debug("RegRouter.vue执行了created事件。");</span>
    },
<span class="fstat-no" title="function not covered" >    mounted: function () {</span>
<span class="cstat-no" title="statement not covered" >      this.octopus.tips.debug("RegRouter.vue执行了mounted事件。");</span>
    },
<span class="fstat-no" title="function not covered" >    beforeUpdate: function () {</span>
<span class="cstat-no" title="statement not covered" >      this.octopus.tips.debug("RegRouter.vue执行了beforeUpdate事件。");</span>
    },
<span class="fstat-no" title="function not covered" >    updated: function () {</span>
<span class="cstat-no" title="statement not covered" >      this.octopus.tips.debug("RegRouter.vue执行了updated事件。");</span>
    },
<span class="fstat-no" title="function not covered" >    activated: function () {</span>
      // 注册路由，如果成功，则跳转，不成功则显示404页面了。
<span class="cstat-no" title="statement not covered" >      this.regRouter();</span>
      // 修改token，造成token过期，看系统是否会自动获取token
      // this.octopus.passport.appKey += "a";
      // console.log(this.octopus.passport);
<span class="cstat-no" title="statement not covered" >      this.octopus.tips.debug("RegRouter.vue执行了activated事件。");</span>
    },
<span class="fstat-no" title="function not covered" >    deactivated: function () {</span>
<span class="cstat-no" title="statement not covered" >      this.octopus.tips.debug("RegRouter.vue执行了deactivated事件。");</span>
    },
    methods: {
<span class="fstat-no" title="function not covered" >      regRouter: function () {</span>
        // 此处接收未注册的URL地址，注意此处的地址是经过64加密的。
        // let base64_url = this.octopus.router.get().query.url;
<span class="cstat-no" title="statement not covered" >        let o = this;</span>
        // 判断路由守护者是否提交了url
<span class="cstat-no" title="statement not covered" >        let reg_url = this.$route.params.data;</span>
<span class="cstat-no" title="statement not covered" >        if (!this.octopus.tools.IsNullOrEmpty(reg_url)) {</span>
          // 此处base64.encode有个bug。。就是输入的字符串如果是[.../?...]，里面的斜杠不会被转移。。导致url看起来多了一层。。。fuck。。。
<span class="cstat-no" title="statement not covered" >          let me_url = "/ESB/Security/OAuth2/Module/Exists/?url=" + this.octopus.tools.base64.encode(reg_url);</span>
          // 发起模块检测请求，如果有该菜单、地址，且当前账户有这个权限，则会返回200及权限列表，否则输出返回的异常。
<span class="cstat-no" title="statement not covered" >          this.octopus.request.api.get(me_url,</span>
            // 处理回调事件，通过分析data.status.code的状态来实现。
<span class="fstat-no" title="function not covered" >            function (data) {</span>
              // 此处返回模块数据以及对应模块的权限，需要保存至全局对象，供当前页面或组件获取。
              // 此处得到的权限用于做功能权限，比如按钮什么的在这里返回，然后路由给当前页面（非组件）
<span class="cstat-no" title="statement not covered" >              o.source = data;</span>
              // console.log(JSON.stringify(data));
<span class="cstat-no" title="statement not covered" >              if (data.status.code == 200) {</span>
                // o.octopus.router.getter().URL_Data = data.content;// 保存菜单的ID，后续页面请求接口时要传到后台ESB用于当前页面下的当前接口的权限验证。
<span class="cstat-no" title="statement not covered" >                o.octopus.router.getter().addRoutes([{</span>
                  path: data.content.Url,// 路径绑定的是url，但是注册的组件地址采用module的方式
                  name: 'DynamicModule_' + data.content.ID,// 每个页面只会存在一个【动态模块】，所以统一名字。
                  component: require('@/components' + data.content.Module).default
                }]);
                // API是严格匹配，所以如果注册的模块和请求的地址不一样是不能访问的。
<span class="cstat-no" title="statement not covered" >                o.octopus.router.getter().push({path: reg_url});</span>
              } else {
<span class="cstat-no" title="statement not covered" >                o.status = true;</span>
<span class="cstat-no" title="statement not covered" >                set();</span>
              }
            });
        } else {
<span class="cstat-no" title="statement not covered" >          this.status = true;</span>
<span class="cstat-no" title="statement not covered" >          set();</span>
        }
&nbsp;
<span class="fstat-no" title="function not covered" >        function set() {</span>
<span class="cstat-no" title="statement not covered" >          $("body").addClass("render");</span>
        }
      },
    },
    props: ["oData", "oDDDDDD"]
  }
&lt;/script&gt;
&nbsp;
&nbsp;</pre></td></tr>
</table></pre>
<div class='push'></div><!-- for sticky footer -->
</div><!-- /wrapper -->
<div class='footer quiet pad2 space-top1 center small'>
  Code coverage
  generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Jan 20 2020 17:54:15 GMT+0800 (GMT+08:00)
</div>
</div>
<script src="..\..\..\..\prettify.js"></script>
<script>
window.onload = function () {
        if (typeof prettyPrint === 'function') {
            prettyPrint();
        }
};
</script>
<script src="..\..\..\..\sorter.js"></script>
</body>
</html>
